Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Latest commit

 

History

History
12 lines (9 loc) · 430 Bytes

13.1.5 - swoole_get_local_ip.md

File metadata and controls

12 lines (9 loc) · 430 Bytes

swoole_get_local_ip

此函数用于获取本机所有网络接口的IP地

function swoole_get_local_ip();
$result = array("eth0" => "192.168.1.100");
  • 目前只返回IPv4地址,返回结果会过滤掉本地loop地址127.0.0.1。
  • 结果数组是以interface名称为key的关联数组。比如 array("eth0" => "192.168.1.100")
  • 此函数会实时调用ioctl系统调用获取接口信息,底层无缓存